#ifndef utils_h
#define utils_h

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <vector>

using namespace	std;
using namespace cv;

//Angulo en sexagesimal
double angleBetween( Point pt1, Point pt2, Point pt0 );
int distanceBetween( Point pt1, Point pt2 );
double distanceBetweenF( Point pt1, Point pt2 );
Point2f computeIntersect(Vec4i a, Vec4i b) ;
bool comparator(Point2f a,Point2f b);
void sortCorners(std::vector<Point2f>& corners, Point2f center);
bool cumpleRatio(int w, int h,double valor, double errorNeg,double errorPos);
bool esParalelogramo(vector<Point2f> poligono,double error);
int * calcularHistograma(unsigned char* img_data, int w, int h);
int * calcularSumaCortesHorizontales(Mat img);
int * calcularSumaCortesVerticales(Mat img);
Mat perspectiva(Mat src, vector<Point2f> corners,int rows,int cols,int k);
int horizontalCrosscut(Mat src,int row);
int * hallarMaximosMitad(int* funcion,int length,int width);
int * hallarTransiciones(int* funcion,int length);
void truncarHistograma(int * hist,int length, int threshold);
bool cumpleRatio(int w, int h,double valor, double error);

#endif